Odoo / UI / Nested Select box filtering
Nested Filtering
-
Step 1:
Example 1
class res_city(models.Model): _name = 'res.city' name = fields.Char('Name') state_id = fields.Many2one('res.country.state', 'State') #and put onchange where you use state and city like: @api.onchange('state_id') def _onchange_state_id(self): if self.state_id: res = {'domain': {'city_id': [('state_id', '=', self.state_id.id)]}} Example 2
@api.onchange('country_id') def _onchange_country_id_wrapper(self): res = {'domain': {'state_id': []}} if self.country_id: res['domain']['state_id'] = [('country_id', '=', self.country_id.id)] return res